import java.util.Map;
import java.util.Scanner;

public class 最长上升子序列 {
    static int N = 1010;
    static int[] arr = new int[N];
    static int[] f = new int[N];
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 1; i <=n ; i++) arr[i] = scanner.nextInt();

        for(int i=1;i<=n ;i++) {
            f[i]=1;
            for (int j = 1; j <i ; j++)
                if(arr[j]<arr[i])
                    f[i] = Math.max(f[i],f[j]+1);

        }
        int max=0;

        for(int i=1;i<=n;i++)
            max = Math.max(f[i],max);

        System.out.println(max);

    }
}
